package com.zmn.plat.admin.controller.product.tariff.item;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.zmn.common.constant.GlobalConsts;
import com.zmn.common.dto2.ResponseDTO;
import com.zmn.plat.model.entity.product.tariff.item.ProductTariffGroupItem;

/**
 * 产品故障项目表，从故障分组的项目中选择
 *
 * @author linfeng
 * @since 2019-11-21 18:57:24
 */
@RestController
@RequestMapping("/product/tariff/item/")
public class ProductTariffGroupItemModifyController extends ProductTariffGroupItemBaseController {

    /**
     * 新增修改
     *
     * @param productFaultItems
     * @author linfeng
     * @since 2019-11-21 18:57:24
     */
    @RequestMapping(value = "batchAddEdit")
    public ResponseDTO addEdit(HttpServletRequest request, @RequestBody List<ProductTariffGroupItem> productFaultItems) {
        try {
            productFaultItemBService.batchAddEdit(getMcStaffRealName(), productFaultItems);
        } catch (Exception e) {
            logger.error("保存产品价格表数据失败", e);
            return ResponseDTO.fail("操作失败！");
        }
        return ResponseDTO.success("ok", GlobalConsts.SUCCESS_MSG);
    }

}
